import { http } from "@/utils/http";
import type { GetCourseCommentListResponse } from "./types";

/**
 * 获取课程评论列表
 * @returns GetCourseCommentListResponse
 */
export const getCourseCommentListApi = (
  page: number,
  limit: number,
  courseId: string
) => {
  return http.get<GetCourseCommentListResponse>(
    `/api/edu/comment/${page}/${limit}`,
    {
      data: { courseId },
    }
  );
};

/**
 * 发布评论
 * @param content 评论内容
 * @param courseId 课程id
 * @param teacherId 教师id
 * @returns {}
 */
export const sendCommentApi = (
  content: string,
  courseId: string,
  teacherId: string
) => {
  return http.post<{}>(`/api/edu/comment/auth/save`, {
    courseId,
    content,
    teacherId,
  });
};
